//
//  IncomeStatementVC.m
//  BestLearning
//
//  Created by 星道 on 17/9/13.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "IncomeStatementVC.h"

@interface IncomeStatementVC ()
{
    IBOutlet UIWebView *_webView;
    IBOutlet UILabel *_title;
    IBOutlet UIActivityIndicatorView *_activity;
}
@end

@implementation IncomeStatementVC

- (void)viewDidLoad {

    [super viewDidLoad];

    self.title = @"收入说明";

    [self RefreshData];

}




- (void)RefreshData {

    NSDictionary *dict = @{
                           @"action"    :@"userGuide",
                           @"type"      :@"2"
                           };
    
    NSString *url = [NSString stringWithFormat:@"user.do?action=userGuide&type=2"];
    
    NSLog(@"%@ %@",LLBaseURLs(url),[AccountTool shareAccountTool].currentAccount.authCode);
    

    [NetManager Get:LLBaseURLs(@"user.do") Auth:YES Params:dict Success:^(id Obj) {
        
        [_activity stopAnimating];
        
        
        
        
        if ([Obj[@"code"] isEqualToNumber:@1000]) {
            
            
            NSString *str = [NSString stringWithFormat:@"%@",[Obj valueForKey:@"t"]];
            
            BOOL  isApp = [NSString isBlankString:str];
            
            if (isApp) {
                
                NSLog(@"fffMMMfff");
                
            }else{
                
                
                NSDictionary *t = [Obj valueForKey:@"t"];
                
                
                
                
                
                
                NSString *htmls = [NSString stringWithFormat:@"<html> \n"
                                   "<head> \n"
                                   "</head> \n"
                                   "<body>"
                                   "<script type='text/javascript'>"
                                   "window.onload = function(){\n"
                                   "var $img = document.getElementsByTagName('img');\n"
                                   "for(var p in  $img){\n"
                                   " $img[p].style.width = '100%%';\n"
                                   "$img[p].style.height ='auto'\n"
                                   "}\n"
                                   "}"
                                   "</script>%@"
                                   "</body>"
                                   "</html>",[NSString stringWithFormat:@"%@", [t valueForKey:@"starRegulation"]]];
                [_webView loadHTMLString:htmls baseURL:nil];
                _webView.scrollView.bounces = NO;
                _webView.scrollView.showsVerticalScrollIndicator = NO;
                _webView.scrollView.showsHorizontalScrollIndicator = NO;
                _title.hidden = NO;
                
            }
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
        } else {
            
            [MBProgressHUD showError:Obj[@"msg"]];
        }

        
        
    } Fail:^(NSError *Error) {
        [_activity stopAnimating];
        [MBProgressHUD showError:@"链接超时"];
    }];
    
    
    
  
}
@end
